package com.ds.plugins.action;

import com.ds.annotation.Aggregation;
import com.ds.annotation.AggregationType;
import com.ds.annotation.Split;
import com.ds.annotation.UserSpace;
import com.ds.common.logging.ChromeProxy;
import com.ds.config.DSMResultModel;
import com.ds.config.ResultModel;
import com.ds.context.JDSActionContext;
import com.ds.esd.annotation.CustomAnnotation;
import com.ds.esd.annotation.MenuBarMenu;
import com.ds.esd.annotation.ModuleAnnotation;
import com.ds.esd.annotation.action.DYNAppendType;
import com.ds.esd.annotation.field.APIEventAnnotation;
import com.ds.esd.annotation.field.DialogAnnotation;
import com.ds.esd.annotation.menu.CustomMenuType;
import com.ds.esd.annotation.ui.RequestPathEnum;
import com.ds.esd.annotation.view.DynLoadAnnotation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping(value = {"/action/resource/"})
@MenuBarMenu(menuType = CustomMenuType.MENUBAR, caption = "资源配置", index = 3)
@Aggregation(type = AggregationType.MENU,userSpace = UserSpace.SYS)
public class ResourcesAction {


    @RequestMapping(value = {"FontList.dyn"}, method = {RequestMethod.POST})
    @ModuleAnnotation(caption = "引入字体", imageClass = "spafont spa-icon-c-label")
    @DynLoadAnnotation(refClassName = "RAD.resource.FontList",append = DYNAppendType.append)
    @APIEventAnnotation(customRequestData = {RequestPathEnum.SPA_PROJECTNAME})
    @CustomAnnotation(index = 0)
    @ResponseBody
    @DialogAnnotation(width = "800", height = "550")
    public ResultModel<Boolean> getFontList(String projectManager) {
        ResultModel resultModel = new ResultModel();
        return resultModel;
    }


    @Split
    @CustomAnnotation(index = 2)
    @ResponseBody
    public ResultModel<Boolean> split() {
        ResultModel resultModel = new ResultModel();
        return resultModel;
    }


    @RequestMapping(value = {"ImageConfigList.dyn"}, method = {RequestMethod.POST})
    @DialogAnnotation(width = "800", height = "550")
    @ModuleAnnotation(caption = "导入图片", imageClass = "spafont spa-icon-html")
    @DynLoadAnnotation(refClassName = "RAD.resource.ImageConfigList",append = DYNAppendType.append)
    @APIEventAnnotation(customRequestData = {RequestPathEnum.SPA_PROJECTNAME})
    @CustomAnnotation(index = 3)
    @ResponseBody
    public DSMResultModel<Boolean> getImageConfigList(String projectManager) {
        DSMResultModel resultModel = new DSMResultModel();
        return resultModel;
    }


    public ChromeProxy getCurrChromeDriver() {
        ChromeProxy chrome  = JDSActionContext.getActionContext().Par(ChromeProxy.class);
        return chrome;
    }



}
